//消失的数字
public class Solution {
    public int missingNumber(int[] nums) {
        int n = nums.length;
        //0-n完整的和-应
        int sum = n * (n + 1) / 2;
        int arrSum = 0;
        //0-n不完整的和-实
        for(int i = 0; i < n; i++){
            arrSum += nums[i];
        }
        return sum - arrSum;
    }

    public static void main(String[] args){
        int[] nums = {0, 1, 2, 4, 5};
        Solution solution = new Solution();
        System.out.println("缺失的数字是：" + solution.missingNumber(nums));
    }
}
